﻿//INSTANT C# NOTE: Formerly VB project-level imports:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Linq;
using System.Xml.Linq;

using Microsoft.IdentityModel.Protocols.WSIdentity;
using System.ComponentModel;
// DisplayClaimsCollection doesn't support databinding and we have to implement a new collection
namespace FederationMetadataEditor
{
	public class CustomDisplayClaimCollection : BindingList<CustomDisplayClaim>
	{

	}

//DisplayClaim has a readonly ClaimType property
	public class CustomDisplayClaim
	{

		public string claimType {get; set;}
		public string displayTag {get; set;}
		public string description {get; set;}
		public string displayValue {get; set;}
		public bool optional {get; set;}
        public IList ClaimTypes { get; set; }

        /// <summary>
        /// Default class constructor
        /// </summary>
        public CustomDisplayClaim()
        {
            InitializeClaimTypes();
        }//constructor

		public DisplayClaim GetDisplayClaim()
		{
			return new DisplayClaim(claimType, displayTag, description, displayValue, optional);
		}

		public static CustomDisplayClaim FromDisplayClaim(ref DisplayClaim claim)
		{
			return new CustomDisplayClaim {claimType = claim.ClaimType, description = claim.Description, displayTag = claim.DisplayTag, displayValue = claim.DisplayValue, optional = claim.Optional};
		}

        /// <summary>
        /// Populates the list of default Claim Types
        /// </summary>
        private void InitializeClaimTypes()
        {
            string[] arrClaimTypes = { "[Pick or type]", "http://schemas.xmlsoap.org/ws/2009/09/identity/claims/actor", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/anonymous", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/authentication", "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationinstant", "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/authorizationdecision", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims", "http://schemas.xmlsoap.org/ws/2009/09/identity/claims", "http://schemas.microsoft.com/ws/2008/06/identity/claims", "http://schemas.microsoft.com/ws/2008/06/identity/claims/cookiepath", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth", "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlyprimarygroupsid", "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlyprimarysid", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/denyonlysid", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dns", "http://schemas.microsoft.com/ws/2008/06/identity/claims/dsa", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", "http://schemas.microsoft.com/ws/2008/06/identity/claims/expiration", "http://schemas.microsoft.com/ws/2008/06/identity/claims/expired", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/gender", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname", "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/hash", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/homephone", "http://schemas.microsoft.com/ws/2008/06/identity/claims/ispersistent", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/locality", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/mobilephone", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/otherphone", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/postalcode", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier", "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarygroupsid", "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid", "http://schemas.microsoft.com/ws/2008/06/identity/claims/role", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/rsa", "http://schemas.microsoft.com/ws/2008/06/identity/claims/serialnumber", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/sid", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/stateorprovince", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/streetaddress", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/system", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/thumbprint", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/uri", "http://schemas.microsoft.com/ws/2008/06/identity/claims/userdata", "http://schemas.microsoft.com/ws/2008/06/identity/claims/version", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/webpage", "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/x500distinguishedname", "http://schemas.xmlsoap.org/claims", "http://schemas.xmlsoap.org/claims/CommonName", "http://schemas.xmlsoap.org/claims/EmailAddress", "http://schemas.xmlsoap.org/claims/Group", "http://schemas.xmlsoap.org/claims/UPN" };
            List<string> collClaimTypes = new List<string>();
            collClaimTypes.AddRange(arrClaimTypes);

            ClaimTypes = collClaimTypes;
        }

	}

}